package com.java.comprehensive.design.behavioral_model.memento_pattern.black_box;


public class Client {
    public static void main(String[] args) {
        System.out.println("-------------------boos start--------------------");
        GameRole gameRole = new GameRole();
        gameRole.initState();
        gameRole.stateDisplay();

        //存储备忘录对象
        RoleStateCaretaker roleStateCaretaker = new RoleStateCaretaker();
        roleStateCaretaker.setRoleStateMemento(gameRole.saveState());
        gameRole.fight();

        System.out.println("-------------------boos end--------------------");
        gameRole.stateDisplay();
        gameRole.recoverState(roleStateCaretaker.getRoleStateMemento());

        System.out.println("--------------------状态回复------------------------");
        gameRole.stateDisplay();

        //和白箱备忘录的区别就是
        // roleStateCaretaker.getRoleStateMemento()这个方法 拿到的对象无法当问到 备忘录发起者角色的属性信息了,而白箱备忘录由于类不是私有可以获取类对象 修改属性
    }
}
